<?php


ini_set('display_errors',1);
set_time_limit(0); 
include_once dirname(dirname(dirname(__FILE__))).'/mgtv_init.php';
include_once dirname(dirname(__FILE__)).'/init.php';

$db = nl_get_db(NL_DB_READ);
$db->open();


$db_w = nl_get_db(NL_DB_WRITE);
$db_w->open();

$sql = "select * from nns_vod_index where nns_deleted != 1";

$info = nl_db_get_all($sql, $db);


foreach ($info as $key => $value) {
	
	
	$sql1 = "select * from nns_mgtvbk_clip_task where nns_org_id='jllt' and nns_video_id='{$value['nns_vod_id']}' and nns_video_index_id='{$value['nns_id']}'";	
	$info1 = nl_db_get_one($sql1, $db);	
	if(is_array($info1)&&$info1!=null){
		continue;
	}
	
	$data = array(
	'nns_id'=>np_guid_rand(),
	'nns_task_type'=>'std',
	'nns_org_id'=>'jllt',
	'nns_video_id'=>$value['nns_vod_id'],
	'nns_video_type'=>0,
	'nns_video_index_id'=>$value['nns_id'],
	'nns_priority'=>0,
	'nns_create_time'=>date('Y-m-d H:i:s'),
	'nns_force'=>0,
	'nns_new_dir'=>0,	
	);
	
	nl_db_insert($db_w, "nns_mgtvbk_clip_task", $data);
}
?>